package org.wzl.personalwebsite.interceptor;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.wzl.personalwebsite.service.LogService;

/**
 * @author 卫志龙
 * @version 1.0
 * @date 2024/9/21 18:21
 */
@Component
public class WebLogInterceptor implements HandlerInterceptor {

    @Resource
    private LogService logService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        logService.setRequestLog(request);
        return true;
    }
}
